export default {
    // 筛选出含有搜索值的好友列表
    friendList: state => state.friendList.filter(friend => friend.remark.includes(state.search)),
    // 根据选中的frendId查询好友
    selectFriend: state => {
        if (state.selectFriendId == 0) {
            return state.user;
        }
        return state.friendList.find(friend => friend.id == state.selectFriendId);
    },
    // 筛选含有搜索值的聊天窗口
    searchChatList: state => state.chatList.filter(chat => chat.user.name.includes(state.search)),
    // 根据选中的chatId查询窗口
    selectChat: state => state.chatList.find(chat => chat.id == state.selectChatId)
}